import { getTenantID } from '@/utils';
import { ILoadMapTypeAll } from '@/common';

/**
 * setTableRowClassName 设置表格单双行类名
 */
export const setTableRowClassName = (_: Record<string, any>, index: number) => {
  return index % 2 == 0 ? 'double-row' : 'default-row';
};
/**
 * @renderOverflowText
 * @description 处理文字溢出
 * @param text 值
 * @param isShowTooltip 是否溢出隐藏并且加Tooltip
 * @returns
 */
export const renderOverflowText = (text: string | number | null, isShowTooltip = false) => {
  const index = ['0', '1'].indexOf(String(text) || '');
  const info = {
    word: text ?? '--',
    color: '',
  };

  if (index != -1) {
    info.word = index == 1 ? '是' : '否';
    info.color = index == 1 ? '#409eff' : 'red';
  }
};

/** 工单类型【orderType】 */
export const orderType = () => {
  return `${getTenantID()}${ILoadMapTypeAll.ALLORDER_TYPE}1027`;
};

/** 业务Controller【controller】*/
export const requestController = () => {
  return 'assetInventory';
};

// <<<========================== 盘点计划 ===========================>>>START
/**`起草`*/
export const PDJH_STATE_QC = () => {
  return `${getTenantID()}${ILoadMapTypeAll?.ASSET_INPLAY_STATUS}1000`;
};
/**`审核中`*/
export const PDJH_STATE_SHZ = () => {
  return `${getTenantID()}${ILoadMapTypeAll?.ASSET_INPLAY_STATUS}1001`;
};
/**`审核未通过`*/
export const PDJH_STATE_WTG = () => {
  return `${getTenantID()}${ILoadMapTypeAll?.ASSET_INPLAY_STATUS}1002`;
};
/**`审核通过`*/
export const PDJH_STATE_TG = () => {
  return `${getTenantID()}${ILoadMapTypeAll?.ASSET_INPLAY_STATUS}1003`;
};

/**`作废`*/
export const PDJH_STATE_ZF = () => {
  return `${getTenantID()}${ILoadMapTypeAll?.ASSET_INPLAY_STATUS}1004`;
};

/** 流程相关&流程类别【category】*/
export const PDJHflowBusinessType = () => `${getTenantID()}${ILoadMapTypeAll.ALLFLOW_TYPE}1016`;

/** 业务流程类别【businessCategory】【CHANGEPURCHASE_METHOD】 */
export const LYbusinessCategory = () => `${getTenantID()}${ILoadMapTypeAll.ASSET_INPLAY_STATUS}1000`;
// <<<========================== 盘点计划 ===========================>>>END
